package com.gary.jvmStack;

import groovy.lang.GroovyShell;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * -XX:MaxMetaspaceSize=24m
 * @author peng_rui
 * @date 2022/8/8
 */
public class TestOomToManyClass {
//    static GroovyShell groovyShell = new GroovyShell();
    public static void main(String[] args) {
        AtomicInteger count = new AtomicInteger();
        while (true) {
            GroovyShell groovyShell = new GroovyShell();
            try (FileReader reader = new FileReader("D:\\codeSpace\\IDEAWorkSpace\\cloud2020\\jvm-study\\src\\main\\resources\\script.groovy")) {
                groovyShell.evaluate(reader);
                System.out.println(count.incrementAndGet());
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}
